package model.effect;

import model.entity.BasicEntity;
import utilities.*;

/**
 * This class represents the effect that changes a specified stat by a percentage amount based on the stats base value
 */
public class PercentChangeStatEffect extends ChangeStatEffect implements Archiveable {

	
	/* --------------------------------------------------------------------------------
	 * Constructors
	   -------------------------------------------------------------------------------- */	
	
	/**
	 * @param name The name of this model
	 * @param statType The name of the Stat that will be modified by this effect
	 * @param amountChanged The percentage the stat will be changed (positive or negative)
	 */
	public PercentChangeStatEffect(String name, String statType, int amountChanged) 
	{
		super(name, statType, amountChanged);
	}

	public PercentChangeStatEffect(){}

	/* --------------------------------------------------------------------------------
	 * Class methods
	   -------------------------------------------------------------------------------- */
	@Override
	public void doEffect(BasicEntity ent) 
	{
		ent.getStats().addPercentModifier(super.getStatType(), super.getAmountChanged());
	}

	@Override
	public String toString()
	{
		return super.toString() + "PercentChangeStatEffect []";
	}
	
	public Archive save() {
		Archive archive = super.save();
		return archive;
	}
	
	public void load(Archive archive) {
		super.load(archive);
	}
	
}
